//
//  ViewController.m
//  AppTime
//
//  Created by 杨康 on 2017/12/23.
//  Copyright © 2017年 杨康. All rights reserved.
//

#import "ViewController.h"
#import "OneViewController.h"
#import "TwoViewController.h"
@interface ViewController ()

@end

@implementation ViewController
#pragma mark 1.非storyBoard都走这个方法
-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    NSLog(@"%s", __FUNCTION__);
    if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) {
        
    }
    return self;
}
#pragma mark 1.纯代码不走这步
-(instancetype)initWithCoder:(NSCoder *)aDecoder
{
    NSLog(@"%s", __FUNCTION__);
    if (self = [super initWithCoder:aDecoder]) {
        
    }
    return self;
}
#pragma mark 1.5 纯代码不走这步
- (void)awakeFromNib {
    [super awakeFromNib];
    NSLog(@"%s", __FUNCTION__);
}
#pragma mark 2.加载视图(默认从nib)
- (void)loadView {
    NSLog(@"%s", __FUNCTION__);
    self.view = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
    self.view.backgroundColor = [UIColor whiteColor];
}
#pragma mark 3.viewDidLoad
- (void)viewDidLoad {
     NSLog(@"%s", __FUNCTION__);
    [super viewDidLoad];
    
    UIButton *testView=[[UIButton alloc]initWithFrame:CGRectMake(0, 100, 19, 19)];
    testView.backgroundColor=[UIColor greenColor];
    [self.view addSubview:testView];
    [testView addTarget:self action:@selector(nnnnn) forControlEvents:UIControlEventTouchUpInside];
}
#pragma mark 4.viewWillAppear
- (void)viewWillAppear:(BOOL)animated {
    NSLog(@"%s", __FUNCTION__);
    [super viewWillAppear:animated];
}
#pragma mark 5.view 即将布局其 Subviews
- (void)viewWillLayoutSubviews {
    NSLog(@"%s", __FUNCTION__);
    [super viewWillLayoutSubviews];
}

#pragma mark 6.view 已经布局其 Subviews
- (void)viewDidLayoutSubviews {
    NSLog(@"%s", __FUNCTION__);
    [super viewDidLayoutSubviews];
}
#pragma mark 7.viewDidAppear
- (void)viewDidAppear:(BOOL)animated {
    NSLog(@"%s", __FUNCTION__);
    [super viewDidAppear:animated];
}
#pragma mark 8.viewWillDisappear
- (void)viewWillDisappear:(BOOL)animated {
    NSLog(@"%s", __FUNCTION__);
    [super viewWillDisappear:animated];
}

#pragma mark 9.viewDidDisappear
- (void)viewDidDisappear:(BOOL)animated {
    NSLog(@"%s", __FUNCTION__);
    [super viewDidDisappear:animated];
}
#pragma mark didReceiveMemoryWarning
- (void)didReceiveMemoryWarning {
    NSLog(@"%s", __FUNCTION__);
    [super didReceiveMemoryWarning];
    
}
#pragma mark 视图被销毁
- (void)dealloc {
    NSLog(@"%s", __FUNCTION__);
}
-(void)nnnnn
{
    TwoViewController *vc=[[TwoViewController alloc]init];
    [self.navigationController pushViewController:vc animated:YES];
}
@end
